import { createWebHistory, createRouter } from 'vue-router'

/**
 * 语音识别系统路由配置
 * 基于你的后端API简化的路由结构
 */

// 公共路由
export const constantRoutes = [
  {
    path: '/redirect',
    component: () => import('@/views/redirect/index.vue'),
    hidden: true
  },
  {
    path: "/:pathMatch(.*)*",
    component: () => import('@/views/error/404'),
    hidden: true
  },
  {
    path: '/401',
    component: () => import('@/views/error/401'),
    hidden: true
  },
  {
    path: '/',
    redirect: '/asr'
  },
  {
    path: '/asr',
    component: () => import('@/views/asr/index'),
    name: 'ASR',
    meta: { title: '语音识别', icon: 'microphone' }
  }
]

// 动态路由（暂时为空，因为后端没有权限系统）
export const dynamicRoutes = []

const router = createRouter({
  history: createWebHistory(),
  routes: constantRoutes,
  scrollBehavior(to, from, savedPosition) {
    if (savedPosition) {
      return savedPosition
    }
    return { top: 0 }
  },
})

export default router
